#region "DevelopmentLibraryEnvironmentVariable"

/*
 * ####     Developer Name : Wang Yucai
 * 
 * ####     Development Tool : Microsoft VisualStudio 2010 Ultimate Edition
 * 
 * ####     Create Time : 2014-07-09 10:55:13
 * 
 * ####     Namespace : Masterduner.SourceStudio.Practices.DevelopmentLibrary.Environments
 * 
 * ####     Type Name : DevelopmentLibraryEnvironmentVariable
 * 
 * ####     Full Name : Masterduner.SourceStudio.Practices.DevelopmentLibrary.Environments.DevelopmentLibraryEnvironmentVariable
 * 
 * ####     Machine Name : GLCHQWYCWINW7
 * 
 * ####     UserName : GUOCOLAND/wangyucai
 * 
 * ####     CLR Version : 4.0.30319.18444
 * 
 * ####     Target Framework Version : 4.0
 */

#endregion

using System;

namespace Masterduner.SourceStudio.Practices.DevelopmentLibrary.Environments
{
    /// <summary>
    /// <para>Masterduner.SourceStudio.Practices.DevelopmentLibrary.Environments.DevelopmentLibraryEnvironmentVariable</para>
    /// <para>
    /// 提供了获取开发库环境变量的方法。
    /// </para>
    /// </summary>
    /// <remarks>
    /// <para>Target Framework Version : 4.0</para>
    /// <para>此类不可继承。</para>
    /// </remarks>
    public sealed class DevelopmentLibraryEnvironmentVariable
    {
        private bool _environmentVariableNotFound;
        private string _installedPath;

        #region InstalledPathEnvironmentVariableName
        /// <summary>
        /// 获取开发库安装路径环境变量名称。
        /// </summary>
        public string InstalledPathEnvironmentVariableName
        {
            get { return "MDSS_DEVLIB_PATH"; }
        }
        #endregion

        #region EnvironmentVariableNotFound
        /// <summary>
        /// 获取是否未发现开发库安装路径环境变量。
        /// </summary>
        public bool EnvironmentVariableNotFound
        {
            get { return _environmentVariableNotFound; }
            private set { _environmentVariableNotFound = value; }
        }
        #endregion

        #region InstalledPath
        /// <summary>
        /// 获取开发库安装路径环境变量（%MDSS_DEVLIB_PATH%）值。
        /// </summary>
        public string InstalledPath
        {
            get { return _installedPath; }
            private set { _installedPath = value; }
        }
        #endregion

        #region Constructor

        /// <summary>
        /// <para>构造函数：</para>
        /// <para>初始化一个<see cref="DevelopmentLibraryEnvironmentVariable" />对象实例。</para>
        /// </summary>
        internal DevelopmentLibraryEnvironmentVariable()
        {
            try
            {
                this.InstalledPath = Environment.GetEnvironmentVariable(this.InstalledPathEnvironmentVariableName, EnvironmentVariableTarget.Machine);
                this.EnvironmentVariableNotFound = false;
            }
            catch
            {
                this.EnvironmentVariableNotFound = true;
                this.InstalledPath = null;
            }
        }

        #endregion
    }
}

#region README

/*
 * ####     ©2014 Wang Yucai
 * 
 * ####     Contact me
 *                  
 *                  E-mail : Masterduner@Yeah.net
 *                  Mobile : 13621384677
 *                  QQ : 180261899
 */

#endregion